#!/bin/bash
#curl -s https://gitee.com/huyiru/huyiru/raw/master/ping.sh | bash
IP=$(ip addr | grep inet |grep -v "127.0.0.1" |grep -v inet6|awk '{print $2}'|awk -F "/" '{print $1}'| head -1|awk -F "." '{print $1"."$2"."$3}')
for ip in `seq 1 255`
do
{
ping -c 1 $IP.$ip > /dev/null 2>&1   
if [ $? -eq 0 ]; then

echo $IP.$ip UP >>/tmp/ip_up.out

else

echo $IP.$ip down >>/tmp/ip_down.out

fi
}&
done
